# Imported target for Rust static library
# This file is used when the library is installed (find_package)

# Compute the installation prefix relative to this file
get_filename_component(_KORNIA_RUST_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_KORNIA_RUST_IMPORT_PREFIX "${_KORNIA_RUST_IMPORT_PREFIX}" PATH)
get_filename_component(_KORNIA_RUST_IMPORT_PREFIX "${_KORNIA_RUST_IMPORT_PREFIX}" PATH)
get_filename_component(_KORNIA_RUST_IMPORT_PREFIX "${_KORNIA_RUST_IMPORT_PREFIX}" PATH)

# Create kornia_rust imported target (matches build tree name)
add_library(kornia_rust STATIC IMPORTED GLOBAL)

# Set library location based on platform
if(WIN32)
    set_target_properties(kornia_rust PROPERTIES
        IMPORTED_LOCATION "${_KORNIA_RUST_IMPORT_PREFIX}/lib/kornia_cpp.lib"
    )
else()
    set_target_properties(kornia_rust PROPERTIES
        IMPORTED_LOCATION "${_KORNIA_RUST_IMPORT_PREFIX}/lib/libkornia_cpp.a"
    )
endif()

# Platform-specific system libraries
if(UNIX AND NOT APPLE)
    # Linux: pthread, dl, m
    target_link_libraries(kornia_rust INTERFACE pthread dl m)
elseif(APPLE)
    # macOS: pthread
    target_link_libraries(kornia_rust INTERFACE pthread)
elseif(WIN32)
    # Windows: ws2_32, userenv, bcrypt, ntdll
    target_link_libraries(kornia_rust INTERFACE ws2_32 userenv bcrypt ntdll)
endif()

# Cleanup
unset(_KORNIA_RUST_IMPORT_PREFIX)

